// pages/Index/Index.js
const app=getApp() 
Page({

  /*
   *
   * 页面的初始数据
   */
  data: 
  {
     LstReportModel:[],
     Item1:[],
     Item2:[],
     Item3:[],
     Item4:[],
     IsDisPlay:["block","none","none","none"],
     Menu_key:"1"
  },
  setDisplay:function(e){

    this.data.IsDisPlay=["none","none","none","none"];
    let index=parseInt(e.currentTarget.dataset.prop);
    this.data.Menu_key=e.currentTarget.dataset.type;
    this.data.IsDisPlay[index]="block";
    this.setData(this.data.IsDisPlay);
    
  },
  /*
   *
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    //console.log('2233Index'+wx.getStorageSync('Token'))
      var that=this;
      let header={'context-type': 'application/json'};
      header['TokenValue'] = app.globalData.utoken;
    wx.request({
      url:app.globalData.urlList+"api/Index/tlspbtnRefresh",
      method:"GET",
      data:{type:that.data.Menu_key},
      header:header,//x-www-form-urlencoded
      success:function(res)
      {
        if (res.statusCode == 200) 
        {
     
        }
      },
      fail:function(res)
      {
         wx.showToast({
           title: '加载失败',
           icon:'error'
         });
      },
      complete:function(res)
      {
        if(res.statusCode == 200) 
        {
            that.setData({LstReportModel:JSON.parse(res.data)});
            var item1 = Object.values(that.data.LstReportModel)[0];
            var item2 = Object.values(that.data.LstReportModel)[1];
            var item3 = Object.values(that.data.LstReportModel)[2];
            var item4 = Object.values(that.data.LstReportModel)[3];
            that.setData({Item1:item1,Item2:item2,Item3:item3,Item4:item4});
        }
      }
    })

  },

  /*
   *
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /*
   *
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /*
   *
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /*
   *
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /*
   *
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function (){

  },

  /*
   *
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /*
   *
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})